from flask import request

from air_web.web_flask.bll.notify_bll import NotifyBll
from air_web.web_flask.common.validator import (
    T_DATE,
    T_INT,
    Fields,
    with_validator,
)
from air_web.web_flask.views.base_page import BasePage


class NotifyPageValidationField:
    """通知接口字段验证类"""

    notify_fields = [
        Fields("compute_date", T_DATE),
        Fields("on5", T_INT)
    ]


class NotifyPage(BasePage):
    @classmethod
    @with_validator(request, NotifyPageValidationField.notify_fields)
    def control_motify(cls):
        args = request.validation_data
        result = NotifyBll().control_res_motify(**args)
        return cls.return_common_func(result, custom_response=True)
